import request from '@/config/axios'
// import type { Dayjs } from 'dayjs';

/** 知识库明细信息 */
export interface BaseTreeDetail {
  id: number; // 数据id
  nodeId: number; // 树节点id
  html: string; // 富文本内容
}

// 知识库明细 API
export const BaseTreeDetailApi = {
  // 查询知识库明细分页
  getBaseTreeDetailPage: async (params: any) => {
    return await request.get({ url: `/knowledge/base-tree-detail/page`, params })
  },

  // 查询知识库明细详情
  getBaseTreeDetail: async (id: number) => {
    return await request.get({ url: `/knowledge/base-tree-detail/get?id=` + id })
  },

  // 新增知识库明细
  createBaseTreeDetail: async (data: BaseTreeDetail) => {
    return await request.post({ url: `/knowledge/base-tree-detail/create`, data })
  },

  // 修改知识库明细
  updateBaseTreeDetail: async (data: BaseTreeDetail) => {
    return await request.put({ url: `/knowledge/base-tree-detail/update`, data })
  },

  // 删除知识库明细
  deleteBaseTreeDetail: async (id: number) => {
    return await request.delete({ url: `/knowledge/base-tree-detail/delete?id=` + id })
  },

  /** 批量删除知识库明细 */
  deleteBaseTreeDetailList: async (ids: number[]) => {
    return await request.delete({ url: `/knowledge/base-tree-detail/delete-list?ids=${ids.join(',')}` })
  },

  // 导出知识库明细 Excel
  exportBaseTreeDetail: async (params) => {
    return await request.download({ url: `/knowledge/base-tree-detail/export-excel`, params })
  },
}
